package cn.com.codingce.student.entity;

import java.util.List;


/**
 * 分页帮助类      包装类
 *
 * @author williamma
 */
public class Page {
    private int currentPage;// 当前页
    private int pageSize;// 页面大小
    private int totalCount;// 总数据
    private int totalPage;// 总页数
    private List<Student> students;// 当前页数据集

    public int getCurrentPage() {
        return currentPage;
    }

    public void setCurrentPage(int currentPage) {
        this.currentPage = currentPage;
    }

    public int getPageSize() {
        return pageSize;
    }

    /*
     * 总页数=数据总数%页面大小==0 数据总数/页面大小 : 数据总数/页面大小/1+1 自动计数
     */
    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
        // 总页数 = 数据总数%页面大小?数据总数/页面大小:数据总数/页面大小+1
        this.totalPage = this.totalCount % this.pageSize == 0 ? this.totalCount / this.pageSize
                : totalCount / this.pageSize + 1;
    }

    public int getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(int totalCount) {
        this.totalCount = totalCount;
    }

    /**
     * 给总页数赋值
     *
     * @return
     */
    public int getTotalPage() {
        return totalPage;
    }

//    public void setTotalPage(int totalPage) { this.totalPage = totalPage; }

    public List<Student> getStudents() {
        return students;
    }

    public void setStudents(List<Student> students) {
        this.students = students;
    }

    public Page(int currentPage, int pageSize, int totalCount, int totalPage, List<Student> students) {
        this.currentPage = currentPage;
        this.pageSize = pageSize;
        this.totalCount = totalCount;
        this.totalPage = totalPage;
        this.students = students;
    }

    public Page() {
    }

}
